﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/Layouts/Admin.Master" AutoEventWireup="true"
    CodeBehind="ProductPrice.aspx.cs" Inherits="MLM.AdminCP.Pages.ProductPrice" meta:resourcekey="PageResource1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
    <asp:Label runat="server" ID="lbproductprice" Text="Product Price Management" 
        meta:resourcekey="lbproductpriceResource1"></asp:Label>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <telerik:RadGrid ID="RadProductPriceGrid" runat="server" AllowFilteringByColumn="True"
        DataSourceID="GroupProductPriceEds" AllowPaging="True" AllowSorting="True" GridLines="None"
        ShowGroupPanel="True"  AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
        AllowAutomaticDeletes="True" ShowFooter="True" ShowStatusBar="True" 
        meta:resourcekey="RadProductPriceGridResource1">
        <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True">
            <Selecting AllowRowSelect="True" />
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="ProductBaseID,CountryID,RoleID"
            DataSourceID="GroupProductPriceEds" ShowHeader="true" ShowHeadersWhenNoRecords="true"
            AllowAutomaticInserts="true" CommandItemDisplay="TopAndBottom" AllowAutomaticUpdates="true">
            <%--<MasterTableView ShowFooter="false" DataKeyNames="ProductID" EditMode="InPlace" CommandItemDisplay="TopAndBottom">--%>
            <CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="true"></CommandItemSettings>
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="ProductPriceID" HeaderText="ProductPriceID" ReadOnly="True"
                    SortExpression="ProductPriceID" UniqueName="ProductPriceID" 
                    Visible="false" meta:resourcekey="GridBoundColumnResource1">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ProductBas.Name" HeaderText="Product" ReadOnly="True"
                    SortExpression="ProductBaseID" UniqueName="ProductBaseID" 
                    meta:resourcekey="GridBoundColumnResource2">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Country.Name" HeaderText="Country" SortExpression="CountryID"
                    UniqueName="CountryID" DataType="System.Int64" ReadOnly="True" 
                    meta:resourcekey="GridBoundColumnResource3">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Role.Name" HeaderText="Group" SortExpression="RoleID"
                    UniqueName="RoleID" DataType="System.Int32" ReadOnly="True" 
                    meta:resourcekey="GridBoundColumnResource4">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Price" DataType="System.Double" HeaderText="Price"
                    SortExpression="Price" UniqueName="Price" DataFormatString="{0} €" 
                    meta:resourcekey="GridBoundColumnResource5">
                </telerik:GridBoundColumn>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" 
                    UniqueName="EditCommandColumn" 
                    meta:resourcekey="GridEditCommandColumnResource1">
                    <ItemStyle CssClass="MyImageButton"></ItemStyle>
                </telerik:GridEditCommandColumn>
                <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                    UniqueName="DeleteColumn" meta:resourcekey="GridButtonColumnResource1">
                    <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                </telerik:GridButtonColumn>
            </Columns>
            <EditFormSettings EditFormType="Template">
                <EditColumn UniqueName="EditCommandColumn1">
                </EditColumn>
                <FormTemplate>
                    <table id="Table2" style="border-collapse: collapse; padding-left: 20">
                        <tr style="height: 30px">
                            <td class="titlename">
                                
                                <asp:Label runat="server" ID="lbproduct" Text="Product" 
                                    meta:resourcekey="lbproductResource1"></asp:Label>
                            </td>
                            <td>
                                <telerik:RadComboBox CssClass="rancombox" ID="RadComboBox3" runat="server" DataTextField="Name"
                                    DataValueField="ProductBaseID" DataSourceID="ProductEds" SelectedValue='<%# Bind("ProductBaseID") %>'
                                    DropDownAutoWidth="Enabled" Height="150px" ItemsPerRequest="10" 
                                    EnableVirtualScrolling="True" meta:resourcekey="RadComboBox3Resource1">
                                </telerik:RadComboBox>
                            </td>
                            <td class="titlename">
                                
                                <asp:Label runat="server" ID="lbCountries" Text="Countries:" 
                                    meta:resourcekey="lbCountriesResource1"></asp:Label>
                            </td>
                            <td style="width: 50">
                                <telerik:RadComboBox CssClass="rancombox" ID="RadComboBox1" runat="server" DataTextField="Name"
                                    DataValueField="CountryID" DataSourceID="GroupCountryEds" SelectedValue='<%# Bind("CountryID") %>'
                                     meta:resourcekey="RadComboBox1Resource1">
                                </telerik:RadComboBox>
                            </td>
                        </tr>
                        <tr style="height: 30px">
                            <td class="titlename">
                                
                                <asp:Label runat="server" ID="lbGroup" Text="Group:" 
                                    meta:resourcekey="lbGroupResource1"></asp:Label>
                            </td>
                            <td style="width: 30">
                                <telerik:RadComboBox CssClass="rancombox" ID="RadComboBox2" runat="server" DataTextField="Name"
                                    DataValueField="RoleID" DataSourceID="GroupRolesEds" SelectedValue='<%# Bind("RoleID") %>'
                                    DropDownAutoWidth="Enabled" Height="150px" ItemsPerRequest="10" 
                                    EnableVirtualScrolling="True" meta:resourcekey="RadComboBox2Resource1">
                                </telerik:RadComboBox>
                            </td>
                            <td class="titlename">
                                
                                <asp:Label runat="server" ID="lbPrice" Text="Price:" 
                                    meta:resourcekey="lbPriceResource1"></asp:Label>
                            </td>
                            <td style="width: 50">
                                <telerik:RadNumericTextBox ID="PriceTxt" runat="server"
                                    DbValue='<%# Bind("Price") %>'  LabelCssClass="" 
                                    meta:resourcekey="PriceTxtResource1" Type="Number" DataType="System.Double">
                                    <NumberFormat DecimalDigits="2" />
                                </telerik:RadNumericTextBox>
                                €
                                <asp:RequiredFieldValidator ID="NumercTextBoxRequiredFieldValidator" runat="server"
                                    Display="Dynamic" ControlToValidate="PriceTxt" 
                                    ErrorMessage="Please, select an year number!" 
                                    meta:resourcekey="NumercTextBoxRequiredFieldValidatorResource1"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-bottom: 10; padding-top: 10" colspan="2">
                                <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" 
                                    CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' 
                                    meta:resourcekey="btnUpdateResource1">
                                </asp:Button>&nbsp;
                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                    CommandName="Cancel" meta:resourcekey="btnCancelResource1"></asp:Button>
                            </td>
                        </tr>
                    </table>
                </FormTemplate>
            </EditFormSettings>
        </MasterTableView>
        <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Office2007">
        </HeaderContextMenu>
    </telerik:RadGrid>
    <asp:EntityDataSource ID="GroupProductPriceEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="ProductPrices" 
        Include="Country,Role,ProductBas">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="GroupCountryEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableFlattening="False" EntitySetName="Countries"
        EntityTypeFilter="Country" Select="it.[CountryID], it.[Name]">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="GroupRolesEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="Roles">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="ProductEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EntitySetName="ProductBases" 
        EntityTypeFilter="ProductBas">
    </asp:EntityDataSource>
</asp:Content>
